<?php
namespace app\course\validate\live;

use think\Validate;

/**
 * 直播课时验证
 */
class LiveSection extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'room_no'           => 'require|integer',
        'title'             => 'require',
        'start_time'        => 'require|integer',
        'end_time'          => 'require|integer',
        'section_id'        => 'require|number',
    ];

    protected $field = [
        'room_no'           => '房间号',
        'title'             => '课时名称',
        'start_time'        => '开课时间',
        'end_time'          => '节课时间',
        'section_id'        => '参数错误',

    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'room'              => ['room_no'],
        'add_hour'          => ['title', 'start_time', 'end_time'],
        'course_datas'      => ['section_id'],
    ];

}
